#include <iostream>
#include <vector>
#include "Asset.h"
#include "Binomial.h"
#include "Option.h"

using namespace std;

int main()
{
	Option option = Option();
	Binomial binomial = Binomial();

	cout << endl << "Part I: Write to ValueOptionsOutput" << endl << endl;
	option.ValueOptions("ValueOptionsInput.csv", "ValueOptionsOutput.txt");

	cout << "Please wait..." << endl;
	int i = 1; 
	while (abs(binomial.BlackScholes('c', 81, 100, 1, 0.05, 0.4) - binomial.CountS(i, 81, 100, 0.05, 0.4, 1, 'C', 'E')) > 0.001)
		i++;
	cout << "B - Part II: Steps = " << i << endl << endl;

	cout << "C - Part II:" << endl;
	cout << "Strike - EuropeanPut - AmericanPut" << endl;
	for (int strike = 80; strike <= 110; strike++)
	{
		cout << strike << " " << binomial.CountS(i, 100 , strike, 0.08, 0.3, 2, 'P', 'E') << " " << binomial.CountS(i, 100 , strike, 0.08, 0.3, 2, 'P', 'A') << endl;
	}

	cout << endl << "D - Part II: Write to ValueDeltaOutput" << endl << endl;	
	option.ValueDelta("ValueDeltaInput.csv", "ValueDeltaOutput.txt");
	return 0;
}